package com.briup.demo.web.controller;
import com.briup.demo.bean.Ware;
import com.briup.demo.service.IWareService;
import com.briup.demo.utils.Message;
import com.briup.demo.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;


@Api(description = "权限接口")
@RestController
@RequestMapping("/ware")
public class WareController {
    @Autowired
       private  IWareService wareService;
    @ApiOperation("查询所有")
    @GetMapping("findAll")
    public Message findAll(){
        List<Ware>list=wareService.findAll();
        return MessageUtil.success(list);
    }
    @ApiOperation("保存或更新")
    @PostMapping("SaveOrUpdate")
    public Message saveOrUpdate(Ware ware){
        wareService.saveOrUpdate(ware);
        return MessageUtil.success("操作成功");
    }
    @ApiOperation("删除所有")
    @GetMapping("delete")
    public Message delete(Long id){
        wareService.delete(id);
        return MessageUtil.success("删除成功");
    }

}
